package org.finesys.common.core.constants;

import java.util.Arrays;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.ToString;

@ToString
@Getter
@NoArgsConstructor
@AllArgsConstructor
public enum ResultCode {

	SUCCESS("0000", "OK"), SYSTEM_EXECUTION_ERROR("A0500", "系统执行出错");

	private String code;

	private String message;

	public static ResultCode getValue(String code) {
		return Arrays.asList(values())
			.stream()
			.filter(v -> v.getCode().equals(code))
			.findFirst()
			.orElse(SYSTEM_EXECUTION_ERROR);
	}

}
